# 定义无参数普通函数
def printInfo():
    print('------------------------------------')
    print('         人生苦短，我用Python')
    print('------------------------------------')

# 调用函数
# printInfo()

# def setNum():
#     num = 0
#     print(num)
#     num += 1
#
# setNum()
# setNum()

# # 定义一个有返回值的函数
# def addNum():
#     a = 1
#     b = 5
#     c = a + b
#     return c
#
# num = addNum()
# print(num)

# # 函数的文档说明
# def func():
#     """
#     这是函数func的说明！
#     :return:
#     """
#     return 1
#
# print(help(func))


# # 函数参数
# def addNum(num1, num2):
#     num3 = num1 + num2
#     print(num3)
#
# a = 10
# b = 14
# # 按参数位置传参
# # addNum(a, b)
# # 关键字传参
# addNum(num2=b, num1=a)

# 默认参数
# def addNum(num1, num2, num3=0):
#     sum_num = num1 + num2 + num3
#     print(sum_num)
# addNum(10, 15, 5)

# 不定长参数
# def addNum(name, *args):
#     sum_num = 0
#     for i in args:
#         sum_num = sum_num + i
#     print("{}计算出来的结果是：{}".format(name, sum_num))
#
# addNum('坚果', 1, 2, 3, 5, 6, 8, 8)

# # 打印每个学生的姓名和年龄
# def printStudent(**kwargs):
#     for i, j in kwargs.items():
#         print(i, j)
#
# printStudent(坚果=18, 江鹏=20)

# def register_3(name, phone, *, city, work_age):
#     print(name, phone, city, work_age)
#
# #调用 不定长参数函数（*单独出现）
# register_3("MS219",'1111111111', city="深圳", work_age="3年")

# # 多个return
# def func(num):
#     if num % 2 == 0:
#         return "这个数是偶数"
#     else:
#         return "这个数是奇数"
#
# value = func(17)
# print(value)


# # 多个返回数据
# def addNum(a, b):
#     # return a, b, a+b
#     return [a, b, a+b]
#
# value = addNum(15, 13)
# print(value)
# print(type(value))